from litemall_0805.frame.pages.home_page import HomePage
from selenium.webdriver.common.by import By


class AddBrandManufacturerPage(HomePage):

    def input_info(self, name, info, price):
        """
        在新增页面中，输入制造商相关信息：名字，介绍
        :param name: 制造商名字
        :param info: 制造商介绍
        :return:
        """
        _IPT_NAME = (By.XPATH, "//*[text()='品牌商名称' and @class='el-form-item__label']/..//input")
        _IPT_INFO = (By.XPATH, "//*[text()='介绍' and @class='el-form-item__label']/..//input")
        _IPT_PRICE = (By.XPATH, "//*[text()='底价' and @class='el-form-item__label']/..//input")
        self.do_send_keys(name, _IPT_NAME)
        self.do_send_keys(info, _IPT_INFO)
        self.do_send_keys(price, _IPT_PRICE)
        return self

    def click_confirm(self):
        """
        点击确定按钮
        :return:
        """
        self.do_click(By.XPATH, "//*[text()='确定']")

        from litemall_0805.frame.pages.mall_manage.brand_manufacturer_list import BrandManufacturerList
        return BrandManufacturerList(self.driver)



    def click_cancel(self):
        pass
